<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script src="../dev/vendors/vue.js"></script>
  <script id="tpl" type="text/x-template">
    <div>123456</div>
  </script>
  <div id="example">
     <my-component></my-component>
  </div>
  <script>
    // 注册
    // Vue.component('my-component', {
    //   template: '<div>A custom component!</div>'
    // })

    var Child = {
      // template: '<div>A custom component!</div>'
    }

    var vm = new Vue({
      el: '#example',
      template: document.getElementById('tpl').innerHTML,
      components: {
        // <my-component> 将只在父模板可用
        'my-component': Child
      }
    })
  </script>
</body>
</html>